package com.quanshu.shop.main.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.quanshu.exchange.R;
import com.quanshu.exchange.support.config.Config;
import com.quanshu.shop.main.entity.ShopMainEntity;

import java.util.List;

/**
 * 作者  李哲
 * 创建时间 2018/7/17
 * 邮箱 lizhetongliao@163.com
 * 说明
 **/
public class ShopMainGoodsFragmentAdapter extends BaseQuickAdapter<ShopMainEntity.GoodsEntity, BaseViewHolder> {
    private Context mContext;

    public ShopMainGoodsFragmentAdapter(@Nullable List<ShopMainEntity.GoodsEntity> data, Context context) {
        super(R.layout.item_recommend_goods, data);
        mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, ShopMainEntity.GoodsEntity item) {
        helper.setText(R.id.item_recommend_txt, item.getName());
        Glide.with(mContext).load(Config.URL_HOST_SHOP + item.getImg()).into((ImageView) helper.getView(R.id.item_recommend_img));
        helper.addOnClickListener(R.id.item_recommend_rl);
    }
}
